<?php

function db_connect() {
    $conn=pg_connect("host=127.0.0.1 user=team2313 password=bcd234");
    return;
}//db_connect()

function pc_validate($user,$pass) {
    /* replace with correct passwords and shit later */
    $users = array('admin' => 'admin');

    if(isset($users[$user]) && ($users[$user] == $pass)) 
        return true;
    else
        return false;
    
}//pc_validate()

function pc_verify() {
    /*
    unset($username);
    if($_COOKIE['login']) {
        list($c_username,$cookie_hash) = preg_split($_COOKIE['login'],',');
        if(md5($c_username.$secret_word) == $cookie_hash) {
            $username = $c_username;
        }//if
        else {
            print "You have sent a bad cookie.";
        }//else
    }//if

    if($username) {
        print "Welcome, $username.";
    }//if
    else {
        print "Welcome, anonymous user.";
    }//else
     * 
     */
}//pc_verify()

function print_login_form() {
    ?>
        <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
            Username: <input type="text" name="username"><br>
            Password: <input type="password" name="password"><br>
            <input type="hidden" name="validate" value="true">
            <input type="submit" value="Log In">
        </form>
    <?
}//print_login_form()

?>